1. Field of the Invention
The disclosures herein generally relate to a technology to control velocity and position of a motor.
2. Description of the Related Art
Motors are widely used for moving objects such as sheets for sheet conveyance control in a printer, heads for head-positioning control in a disc storage device, etc. To control the position and the velocity of an object that is to be moved by the motor, a position sensor and/or a velocity sensor may be attached to the motor shaft or the object to be moved. A signal from the sensor is used for comparing the target position and/or velocity with the sensed current position and/or velocity, to feedback-control a motor drive quantity of the object.
To execute such feedback control, digital control is widely used where a microcomputer, which is equipped with a CPU (Central Processing Unit), a memory and input/output ports and the like, sample sensor signals periodically and output computed motor drive quantity. To execute the digital control, it is common to use an interrupt mechanism generally provided with a microcomputer, which makes an interrupt request to a CPU in a prescribed sampling cycle to carry out control processing with an interrupt routine.
Japanese Laid-open Patent Application No. 2006-338367 (referred to as Patent document 1 hereinafter) discloses a technology used in an electronic device that controls a motor drive quantity with a timer interrupt, which prevents precision of control from being deteriorated if an execution of the interrupt routine is delayed. Namely, in Patent document 1, if an execution of a timer interrupt signal, which is generated at a prescribed interval to execute a motor driving operation, is delayed by another execution caused by another interrupt signal, the delay time between the interrupt signal generation and the interrupt routine execution is computed to correct position information for feedback control.
Japanese Laid-open Patent Application No. 2011-44006 (referred to as Patent document 2 hereinafter) discloses a technology to obtain a present position without using a high performance counter or an ASIC (Application Specific Integrated Circuit) chip as the counter. Namely, in Patent document 2, a moving body controller is disclosed, which includes a two-phase counter detecting each of two-phase pulse signals output from an encoder, and performing count processing, and a one-phase counter detecting only A-phase pulse signal of the signals, and performing count processing. The moving body controller calculates a position error that is a difference between a target position and a present position acquired by the counters, outputs a target velocity corresponding to the position error from an amplification device, decides whether the position error is comparatively small or large by an error decision device, and determines the present position by the two-phase counter if the position error is comparatively small, or by the one-phase counter if the position error is comparatively large.
Patent document 1 above deals with a problem in that precision of control deteriorates when another interrupt routine has priority over the interrupt routine for motor controlling, resulting in a delayed execution of a motor controlling operation. However, even using the technology in Patent document 1, it is inevitable that precision deteriorates to a certain degree. Moreover, a delay between the sampling and the output of the motor drive quantity causes a phase delay of the control quantity, which reduces phase margin and destabilizes control according to the feedback control theory. In the worst case, oscillation or other unstable states may be induced.
Patent document 2 also discloses a technology for feedback control of position and velocity using a microcomputer. In this case, it does not accept other interrupts, which causes no delay for motor control processing.
However, both conventional technologies may have a possibility that an interrupt process does not end within a prescribed cycle, if the number of operations to be executed during the interrupt process increases. If that is the case, normal operations cannot be completed, resulting in a state of collapse.
The possibility that an interrupt process does not end may rise if the cycle for an interrupt process is shortened to try to get better control performance, or a software counter is used instead of an expensive hardware counter to lower cost. Simply shortening the cycle or using a software counter may be problematic.